feat(cdr): export push and queue pipeline metrics - #269
Open
ftong2010 wants to merge 1 commit into
Open
Conversation
Mirror the RWI webhook pipeline observability for CDR: producers now count enqueues and drops at the bounded-channel boundary (reporter try_send), the manager counts pushed vs push-failed records per saver batch, and queue depth/capacity gauges are sampled every 5s. An opt-in [callrecord] track_queue_latency flag records the queueing-wait histogram cdr_queue_latency_seconds (enqueued → manager dequeued) via a transient RecordEnqueuedAt instant stashed in the record extensions — save/push time is excluded by design.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The CDR pipeline — call producers → bounded queue (
[callrecord] channel_capacity) → manager → saver (http/database/local/s3) — has no observability. When the configured endpoint slows down,records pile up in the bounded channel and are dropped with only a warn
log (
call record channel full; dropping record); nothing surfaces in/metrics, so CDR loss stays invisible until reconciliation. This addsthe same pipeline observability the RWI webhook path got in #267.
What this PR adds
try_sendfailures (
FullandClosed) now countcdr_records_dropped_totalin addition to the existing warn.
capacity as a static gauge.
[callrecord] track_queue_latency— measures queue wait only (record enqueued →manager dequeued). A slow saver endpoint inflates backlog, not this
histogram.
Metrics
cdr_records_enqueued_totalcdr_records_pushed_totalcdr_records_push_failed_totalcdr_records_dropped_totalcdr_queue_sizecdr_queue_currentcdr_queue_latency_secondstrack_queue_latencyHealthy pipeline:
enqueued == pushed,dropped == 0,queue_currentnear 0.
Implementation notes
CallRecord.extensions(RecordEnqueuedAt,never serialized) so the channel item type is unchanged; only the
histogram recording is config-gated.
pushed/push_failedare counted per saver batch, matching theCallRecordSavercontract (batch-levelOk/Err).Configuration
[callrecord] track_queue_latencyfalseVerification
10 cps × 60 s load test (600 calls,
type = "http"saver to an externalrouter), with
track_queue_latency = true:cdr_records_enqueued_total 600==cdr_records_pushed_total 600;dropped 0, push_failed 0
cdr_queue_size 2048;cdr_queue_current 0after draincargo test --lib callrecord: 75 pass; the 3 failing recording/sipflowupload tests fail identically on unmodified
main(pre-existing,unrelated). Note:
cargo test --libcurrently needs #268 to compile.Docs
docs/observability.mdgains a "Call Record (CDR) Pipeline" metricssection;
docs/config/06-media-recording.mddocuments the pipelineoptions and links to it.